package com.bosicen.crm.dao.process;

import java.util.List;


import org.springframework.stereotype.Component;
import com.bosicen.crm.dao.HibernateDao;
import com.bosicen.crm.dao.entity.OrderProcess;

@Component("orderProcessDao")
@SuppressWarnings("unchecked")
public class OrderProcessDao extends HibernateDao<OrderProcess, Integer> {

	/****
	 * 查询列表
	 * @param id
	 * @return
	 */
	
	public List<OrderProcess> findOrderProcessList(int companyid){
		return this.getSession().createQuery(" from OrderProcess where companyid=?  order by id desc").setParameter(0, companyid).list();
	}
	
	/****
	 * 查询列表
	 * @param id
	 * @return
	 */
	
	public List<OrderProcess> findOrderProcessList(){
		return this.getSession().createQuery(" from OrderProcess  order by id desc").list();
	}
	/**
	 * 按ID查询
	 * @param id
	 * @return
	 */
	public OrderProcess findOrderProcessById(int id){
		return this.get(id);
	}
	
	/***
	 * 删除
	 * @param c
	 */
	public void delOrderProcess(OrderProcess c){
		this.delete(c.getId());
	}
	
	/**
	 * 保存
	 */
	public void saveOrUpdate(OrderProcess orderProcess){
		this.getSession().saveOrUpdate(orderProcess);
	}
	
}
